package com.clkj.xiuzheng.dao.shangcheng;

import com.clkj.xiuzheng.pojo.shangcheng.TopicOrVideo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface TopicOrVideoMapper extends Mapper<TopicOrVideo> {
    @Select("SELECT a.*,b.category_name FROM t_xz_TopicOrVideo a " +
            "left join t_xz_topicCategory b on a.category_id = b.category_id  " +
            "WHERE baike_type=#{flag} and a.company_id = #{companyId}")

    @Update("update t_xz_TopicOrVideo set collection_num +=#{status} where baike_id = #{productId}  ")
    void updateCollect(Integer productId,Integer status);
    @Update("update t_xz_TopicOrVideo set prise_num +=#{status} where baike_id = #{productId}  ")
    void updatePrise(Integer productId,Integer status);

    @Update("update t_xz_TopicOrVideo set comment_num +=1 where baike_id = #{topicId}")
    void updateCommentNum(@Param("topicId")Integer topicId);

    @Select("select * from t_xz_topicOrVideo where company_id = #{companyId} and baike_type =#{flag} order by is_top desc ")
    List<TopicOrVideo> getTopicOrVideoList(@Param("companyId") Integer companyId, @Param("flag") Integer flag);
}
